﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="~/Content/History/history.css" media="all" />
    <script src="~/Scripts/layui/layui.all.js"></script>
    <link rel="stylesheet" href="~/Scripts/layui/css/layui.css" media="all"/>
    <title>历史记录</title>
</head>
<body>
    <div class="wap">
        <div class="excels" style="display:none">
            <div class="radio_k">
                <div class="l"><input type="radio" value="year" name="ymtype">年报表</div>
                <div class="l"><input type="radio" value="month" name="ymtype" checked="checked">月报表</div>
            </div>
            <select name="se_year" id="year">
                <option value="">选择年份</option>
                <option value="2019">2019年</option>
                <option value="2018">2018年</option>
                <option value="2017">2017年</option>

            </select>
            <select name="se_month" id="month">
                <option value="">选择月份</option>
            </select>
            <div class="list-state" id="excel">导出 excel表格</div>
        </div>
        <div>
            <div style="font-size:20px;text-align:center;">@ViewBag.Map["Name"]</div>
            <div style="font-size:16px;">地址：@ViewBag.Map["Address"]</div>
        </div>
        <div class="geduan"></div>

        <!-- 列表 -->
        <div>
            <div class="list-top">
                @*<div class="before_day l" onclick="selecttime('before')"></div>*@
                <select class="l" style="width:20%" id="ChannelNum">
                    <option value="1" selected>通道1</option>
                    <option value="2">通道2</option>
                </select>
                <select class="l" style="width:40%" id="SearchTime">
                    @for (int i = 0; i < 100; i++)
                    {
                        <option value="@DateTime.Now.AddDays(-i).ToString("yyyy-MM-dd")">@DateTime.Now.AddDays(-i).ToString("yyyy-MM-dd")</option>
                    }

                </select>


                <div class="rear_day l" style="width:20%;" onclick="Search()">查询</div>
                <div class="clear"></div>
            </div>
            @*<div class="list-top">
                <div class="before_day l" onclick="selecttime('before')">前一天</div>
                <input type="text" class="l" name="start_time" id="countTimestart" onfocus="selecttime('current')" value="@DateTime.Now.ToString("yyyy-MM-dd")">
                <div class="rear_day l" onclick="selecttime('rear')">后一天</div>
                <div class="clear"></div>
            </div>*@
            <div class="list-t">
                <div class="list-t-t">时间</div>
                <div class="list-t-t">油烟</div>
                <div class="list-t-t">NMHC</div>
                <div class="list-t-t">颗粒物</div>
                <div class="list-t-t">状态</div>
                <div class="clear"></div>
            </div>
        </div>
        <div class="list">
            @*<div class="list-c">
                <div class="list-c-t">17:05</div>
                <div class="list-c-t">2.6</div>
                <div class="list-c-t">4.4</div>
                <div class="list-c-t">4.8</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>*@

        </div>

        <div class="geduan"></div>

        <!-- 列表 -->
        @*<div>
            <div class="list-top">
                <div class="before_days l" onclick="selecttimes('before')">前一小时</div>
                <input type="text" class="l" id="countTimestarts" onfocus="selecttimes('current')" value="11-03 17:00">
                <div class="rear_days l" onclick="selecttimes('rear')">后一小时</div>
                <div class="clear"></div>
            </div>
            <div class="list-t">
                <div class="list-t-t">时间</div>
                <div class="list-t-t">油烟</div>
                <div class="list-t-t">颗粒物</div>
                <div class="list-t-t">非甲烷</div>
                <div class="list-t-t">状态</div>
                <div class="clear"></div>
            </div>
        </div>
        <div class="lists">
            <div class="list-c">
                <div class="list-c-t">17:33</div>
                <div class="list-c-t">2.4</div>
                <div class="list-c-t">4</div>
                <div class="list-c-t">4.4</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:32</div>
                <div class="list-c-t">2.5</div>
                <div class="list-c-t">4.2</div>
                <div class="list-c-t">4.6</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:31</div>
                <div class="list-c-t">2.5</div>
                <div class="list-c-t">4.2</div>
                <div class="list-c-t">4.6</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>


            <div class="list-c">
                <div class="list-c-t">17:05</div>
                <div class="list-c-t">2.6</div>
                <div class="list-c-t">4.4</div>
                <div class="list-c-t">4.8</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:04</div>
                <div class="list-c-t">2.8</div>
                <div class="list-c-t">4.6</div>
                <div class="list-c-t">5.1</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:03</div>
                <div class="list-c-t">2.2</div>
                <div class="list-c-t">3.6</div>
                <div class="list-c-t">4</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:02</div>
                <div class="list-c-t">0.8</div>
                <div class="list-c-t">1.4</div>
                <div class="list-c-t">1.5</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:01</div>
                <div class="list-c-t">3.1</div>
                <div class="list-c-t">5.2</div>
                <div class="list-c-t">5.7</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">17:00</div>
                <div class="list-c-t">2.5</div>
                <div class="list-c-t">4.2</div>
                <div class="list-c-t">4.6</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
            <div class="list-c">
                <div class="list-c-t">16:59</div>
                <div class="list-c-t">1</div>
                <div class="list-c-t">1.6</div>
                <div class="list-c-t">1.8</div>
                <div class="list-c-t">良好</div>
                <div class="clear"></div>
            </div>
        </div>*@
        <div class="geduan"></div>

        <div class="submits" onclick="goMain()">返回</div>
        <div style="font-size:12px;margin-top:10px;margin-bottom:10px;width:100%;text-align:center">
            ©2020 德器(重庆)科技有限公司 服务热线 400-9019-505
            @*重庆环元环境科学研究院*@
        </div>
    </div>

    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    @*<script src="~/Scripts/myDate/select.js" type="text/javascript"></script>
    <script src="~/Scripts/myDate/WdatePicker.js" type="text/javascript"></script>
    <script src="~/Scripts/history/history.js" type="text/javascript"></script>*@
    <div style="position: absolute; z-index: 100006; display: none; top: 188.375px; left: 124.875px;" lang="zh-cn"><iframe hidefocus="true" width="9" height="7" frameborder="0" border="0" scrolling="no" src="about:blank" style="width: 186px; height: 198px;"></iframe></div>
    <script type="text/javascript">
        var MN="@ViewBag.MN";
        function Search() {
            var time = $("#SearchTime").val();
            var ChannelNum = $("#ChannelNum").val();

            $(".list").empty();
            $.ajax({
                type: "POST",
                url: "/DataView/GetDataByTime",
                async: false,
                data: { StartTime: time, "MN": MN, "ChannelNum": ChannelNum },
                success: function (data) {
                    var str = "";
                    for (var i = 0; i < data.length; i++) {
                        str = "";
                        str = '<div class="list-c">' +
                            '<div class="list-c-t">' + data[i].DataTime + '</div>' +
                            '<div class="list-c-t">' + data[i].Y1 + '</div>' +
                            '<div class="list-c-t">' + data[i].V1 + '</div>' +
                            '<div class="list-c-t">' + data[i].K1 + '</div>';
                        if (data[i].Y1 > 1 || data[i].V1 > 10) {
                            str += '<div class="list-c-t" style="color:red;">超标</div>';
                        }
                        else {
                            str += '<div class="list-c-t">良好</div>';
                        }
                            
                        str +=        '<div class="clear"></div>' +
                            '</div>';
                        $(".list").append(str);                                                                                                                                                                                    
                    }
                }
            });
        }
        function goMain() {
            window.location.href = "/DataView/Main";
        }
    </script>

</body>
</html>
